package com.exam.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 *试卷分类实体 2012-12-12
 * 
 * @author MuLing
 * 
 */
@Entity
@Table(name = "tb_paper_Content_Type")
public class PaperContentType implements Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	// 指定为主键
	private Integer id;

	@Column(name = "pct_name", length = 30, unique = true)
	// 分类名称
	private String name;

	@Column(name = "pct_remark", length = 30, unique = true)
	// 分类备注
	private String remark;

	private Integer pid;// 父分类

	@OneToMany(fetch = FetchType.EAGER, targetEntity = PaperContentType.class, cascade = { CascadeType.ALL })
	@JoinColumns(value = { @JoinColumn(name = "pid", referencedColumnName = "id") })
	@OrderBy(value = "name desc")
	// 所拥有的子分类
	private List<PaperContentType> paperContentTypeList = new ArrayList<PaperContentType>();

	/**
	 * @param paperContentTypeList
	 *            the paperContentTypeList to set
	 */
	public void setPaperContentTypeList(
			List<PaperContentType> paperContentTypeList) {
		this.paperContentTypeList = paperContentTypeList;
	}

	/**
	 * @return the paperContentTypeList
	 */
	public List<PaperContentType> getPaperContentTypeList() {
		return paperContentTypeList;
	}

	/**
	 * @param remark
	 *            the remark to set
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * @return the remark
	 */
	public String getRemark() {
		return remark;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param pid
	 *            the pid to set
	 */
	public void setPid(Integer pid) {
		this.pid = pid;
	}

	/**
	 * @return the pid
	 */
	public Integer getPid() {
		return pid;
	}

}
